<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <button>你好</button>
</body>
<script>
    function print() {
        console.log('你好，新世界');
    }
    function throttle(fn, delay) {
        let timer = null, pre
        return function() {
            if(Date.now()-pre < delay && timer) {
                return
            }
            if(!timer) {
                fn()
            }
            timer = setTimeout(() => {
                fn()
            }, delay)
            pre = Date.now()
        }
    }
    window.addEventListener('click', throttle(print, 3000))
</script>
</html>